package org.zoomdev.zoom.lock.modules;


import org.zoomdev.zoom.lock.LockFactory;
import org.zoomdev.zoom.lock.PoolException;

public class ObjectLockFactory extends DefaultKeyedObjectPool<Object> implements LockFactory<Object> {

    public ObjectLockFactory() {
        super();
    }

    public ObjectLockFactory(int count) {
        super(count);
    }

    @Override
    protected void initObject(Object data, String key) {

    }

    @Override
    protected Object createObject(String key) {
        return new Object();
    }

    @Override
    protected Object clearObject(Object data, String key) {
        return data;
    }

    @Override
    public Object tryFetch(String key) {
        try {
            return fetch(key);
        } catch (PoolException e) {
            return null;
        }
    }
}
